import java.util.Scanner;
public class Hw411 {
    public static void main(String[] args) {
        //题例实现
        int num = 10;
        int sum = 0,avg;
        int[] score = {72, 89, 65, 87, 91, 82, 71, 93, 76, 68};
        for (int i = 0; i < score.length; i++) {
            sum += score[i];
        }
        avg = sum / num;
        System.out.println("平均成绩为" + avg);

        /*
        //输入成绩并输出平均成绩
        int num = 10;
        int sum = 0,avg;
        int[] score = new int[num];

        Scanner sc = new Scanner(System.in);
        System.out.println("请输入"+num+"个学生成绩!");

        for (int i = 0; i < score.length; i++) {
            System.out.print("第"+(i+1)+"个学生成绩:");
            score[i] = sc.nextInt();
            if ((score[i] < 101) && (score[i] >= 0)){
                sum += score[i];
            }else {
                System.out.println("重新输入!");
                i--;//超范围分数,索引回退,重新输入
            }
        }

        avg = sum / num;
        System.out.println("平均数为:" + avg);
        */
    }
}
